import axios from '@/utils/axios'

const authQrcodeApi = '/wx/sp/open/auth/get_auth_qrcode' // 授权二维码
// const preAuthUrlApi = '/wx/sp/open/auth/pre_auth_url' // 授权url
// const checkAuthApi = '/wx/sp/open/auth/check_auth' // 检查授权
const refreshMpApi = '/wx/sp/auth/record/refresh_mp' // 刷新mp信息
const queryAuthApi = '/wx/sp/open/auth/query' // 二维码状态
const mpListApi = '/wx/sp/auth/record/mp_list' // mp列表
// const authMaInfoApi = '/wx/sp/open/authorization/mp' // mp信息
// const wechatAuthUrlApi = '/wx/sp/open/auth/pre_auth_url' // 授权url
const authMaInfoApi = '/wx/sp/open/authorization/ma' // ma信息

/**
 * @desc 授权二维码
 */
export const authQrcode = ({ data }) => {
  return axios.post(authQrcodeApi, data)
}

/**
 * @desc 二维码状态
 */
export const queryAuth = ({ params }) => {
  return axios({
    url: queryAuthApi,
    method: 'get',
    params: params
  })
}

/**
 * @desc mpList
 */
export const mpList = () => {
  return axios.get(mpListApi)
}

/**
 * @desc 刷新mp
 */
export const refreshMp = ({ params }) => {
  return axios({
    url: refreshMpApi,
    method: 'post',
    params: params
  })
}

/**
 * @desc 授权小程序信息
 */
export const authMaInfo = ({ params }) => {
  return axios({
    url: authMaInfoApi,
    method: 'get',
    params: params
  })
}

// 授权
// export function wechatAuthUrl({ params }) {
//   return axios({
//     url: wechatAuthUrlApi,
//     method: 'get',
//     params: params
//   })
// }

